package com.allqj.sfx.infrastructure.exceptions;

/**
 * @author sjw
 * @className BusinessException
 * @date 2022/7/19 8:51
 * @description: 业务异常
 */
public class BusinessException  extends RuntimeException {
    // 业务异常状态吗
    private int statusCode;
    // 业务异常信息（供前端展示）
    private String message;

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public BusinessException(Integer statusCode, String message) {
        this.statusCode = statusCode;
        this.message = message;
    }

    public static void throwException(Integer statusCode, String message) {
        throw new BusinessException(statusCode, message);
    }
}
